package org.springblade.modules.app.controller;

import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.modules.app.entity.Jpush;
import org.springblade.modules.app.service.IJpushService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 极光推送 控制器
 *
 * @author BladeX
 * @since 2020-10-20
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-app/jpush")
@Api(value = "极光推送", tags = "极光推送接口")
public class JpushController extends BladeController {

    private final IJpushService jpushService;


    /**
     * 新增或修改 极光推送
     */
    @PostMapping("/saveOrUpdate")
    public R submit(@RequestBody Jpush jpush) {
        jpush.setCtime(new Date());
        return R.status(jpushService.saveOrUpdate(jpush));
    }


}
